package com.chance.cc.crawler.prod.command.trigger.domain.news.douban;

import com.chance.cc.crawler.core.CrawlerJob;
import com.chance.cc.crawler.meta.core.bean.CrawlerMetaConstant;
import com.chance.cc.crawler.prod.command.job.domain.news.douban.searchKw.DouBanRealtimeCrawlerSchedulerJob;
import com.chance.cc.crawler.prod.command.job.domain.news.douban.searchKw.DouBanTraceTraceCrawlerSchedulerJob;
import com.chance.cc.crawler.prod.command.trigger.CommonCrawlerSchedulerTrigger;

/**
 * @author lt
 * @version 1.0
 * @date 2020-12-09 16:15:28
 * @email okprog@sina.com
 */
public class DouBanCommonCrawlerScheduleTrigger extends CommonCrawlerSchedulerTrigger {
    public static void main(String[] args) {
//        publishDouBanSearchKwTraceTraceCrawlerScheduleTriggerInfo();
        publishDouBanSearchKwRealtimeCrawlerScheduleTriggerInfo();
    }

    public static void publishDouBanSearchKwTraceTraceCrawlerScheduleTriggerInfo(){
        CrawlerJob crawlerJob = DouBanTraceTraceCrawlerSchedulerJob.crawlerSchedulejob();

        metaServiceCommand_17.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                DouBanTraceTraceCrawlerSchedulerJob.domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 1 * * ?",
                "豆瓣回溯7天采集任务执行，每天凌晨1点开始执行"
        );
    }

    public static void publishDouBanSearchKwRealtimeCrawlerScheduleTriggerInfo(){
        CrawlerJob crawlerJob = DouBanRealtimeCrawlerSchedulerJob.crawlerSchedulejob();

        metaServiceCommand_17.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                DouBanRealtimeCrawlerSchedulerJob.domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 0/2 * * ?",
                "豆瓣每两个小时采集一次"
        );
    }
}
